/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package core.messages.client.inGame;
import core.threads.DataBase;
import cstAndEnum.SKILL_TYPE;
import java.util.ArrayList;
import java.util.List;
import models.Card.Card;
import models.CastInfo;
import models.Player;
import models.Skill.Skill;

/**
 * 客户端发送，具体（有）回应的Msg
 * @author Invince
 */
public class Msg_Response_Yes extends Msg_Response{
/*----------Attributs-------------------*/
    /**
     * 回应牌的id
     */
    protected int idCard;
    /**
     * 回应所使用的Skill的id
     */
    protected int idSkill;
    /**
     * 回应者的id，这里为自己的id，这里是加快效率
     */
    protected int idSource;
    /**
     * 回应对象的id
     */
    protected int idTargetPlayer;//只有一个Target
    /**
     * 回应所搭上的牌的id，比如回应吕布的决斗，得用两张杀，其中一张应该摆在这里
     */
    protected int[] idTargetCards;
    /**
     * 回应所用的技能是否是主公技
     */
    protected SKILL_TYPE skillType;

/*----------Public functions------------*/
    public CastInfo getCastInfo(){
        Player source=DataBase.findPlayerByID(idSource);
        List<Player> targetPlayers=new ArrayList<Player>();
        targetPlayers.add(DataBase.findPlayerByID(idTargetPlayer));
        Skill skill=DataBase.findSkillByID(idSkill);
        Card card=DataBase.findCardByID(idCard);
        List<Card> targetCards=new ArrayList<Card>();
        for(int id:this.idTargetCards){
            targetCards.add(DataBase.findCardByID(id));
        }
        CastInfo rCI=new CastInfo(source, targetPlayers, skill, card, targetCards,this.skillType);
        return rCI;
    }
/*----------Private functions-----------*/
/*----------Constructor-----------------*/
    public Msg_Response_Yes(String sender, String receiver, int idCard, int idSkill,int idSource, int idTarget,int[] idTargetCards,SKILL_TYPE skillType) {
        super(sender, receiver);
        this.idCard = idCard;
        this.idSkill = idSkill;
        this.idSource=idSource;
        this.idTargetPlayer = idTarget;
        this.skillType=skillType;
        this.idTargetCards=idTargetCards;
    }

/*----------Gets and sets---------------*/
     public int getIdCard() {
        return idCard;
    }

    public void setIdCard(int idCard) {
        this.idCard = idCard;
    }

    public int getIdSkill() {
        return idSkill;
    }

    public void setIdSkill(int idSkill) {
        this.idSkill = idSkill;
    }

    public int getIdSource() {
        return idSource;
    }

    public void setIdSource(int idSource) {
        this.idSource = idSource;
    }

    public int getIdTarget() {
        return idTargetPlayer;
    }

    public void setIdTarget(int idTarget) {
        this.idTargetPlayer = idTarget;
    }

    public SKILL_TYPE getSkillType() {
        return skillType;
    }

    public void setSkillType(SKILL_TYPE skillType) {
        this.skillType = skillType;
    }



}
